package com.example.neo4j.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Property;
import org.springframework.data.neo4j.core.schema.Relationship;

import java.util.List;

/**
 * 人员实体类
 */
@Data
@NoArgsConstructor
@Node("Person")
public class PersonEntity {
    @Id
    private String name;

    @Property("born")
    private Integer born;

    public PersonEntity(Integer born, String name) {
        this.born = born;
        this.name = name;
    }

    @Relationship(type = "FRIEND_OF", direction = Relationship.Direction.INCOMING)
    private List<PersonEntity> friends;
}